Dynamic languages that lack type annotations of any kind are increasingly popular. For example, JavaScript has become the lingua franca of the World Wide Web, while RUBY®, PYTHON®, PERL®, and PHP® have become standard languages for server-side infrastructure. However, runtime of dynamic language based code may require significant overhead as optimal compilation strategies may not be available to compile the code.
For example, JavaScript does not allow a program to specify the types of variables. Thus, during runtime, a variable may be dynamically converted into separate types in different execution paths. Such conversions may be computationally expensive with high impact of overall performance. Further, dynamically created data types may require significant lookup or search operations among indexed data structures, such as dictionaries, to assign a type to a data or to access property of data of a certain type.
Furthermore, modern JavaScript engines are required to execute un-trusted code very quickly, and for this reason use runtime code generation through mechanisms such as Just In Time (JIT) compilation, which may be used by an attacker to bypass OS/hardware protection. Existing protection techniques, such as constant blinding, may be adopted to block such attacks. However, these techniques may incur performance costs, both in terms of memory use and processor execution time, on a target code regardless of the risk of the target code being executed.
Therefore, traditional dynamic runtime compilation approaches tend to be costly, inefficient and non-optimized.